
import api from '../../api/models/api.js';

function getcallyList(){
        api.getComponentsAutomaticallyList({current:1,size:99}).then(async res=>{
            console.log(res.data.records)
            let customList=await res.data.records
            let list=[]
            if(customList){
                for(let item of customList){
                    if(item.componentsAutomaticallyData.length>20){
                        list.push(JSON.parse(item.componentsAutomaticallyData))
                    }
                }
                localStorage.setItem('Custom_components',JSON.stringify(list))
                localStorage.setItem('Global_Custom_components',JSON.stringify(customList))
                 let locationNum=localStorage.getItem('locationNum')
                 if(locationNum&&locationNum<2){
                     localStorage.setItem('locationNum',locationNum+1)
                     location.reload()
                 }else{
                    localStorage.setItem('locationNum',1)
                   return
                 }
            }
        })
}
getcallyList()
  let customDataList=JSON.parse(localStorage.getItem('Custom_components'))?JSON.parse(localStorage.getItem('Custom_components')):[]
export default customDataList